/**
 * StarBannerNode.java
 *
 * Roslan's Remake of MOO in 3D using Ardor3D
 * (C) 2011 Roslan Amir. All rights reserved.
 */

package com.roslan.games.moo3d.spatial;

import com.ardor3d.image.Texture;
import com.ardor3d.image.TextureStoreFormat;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.BillboardNode;
import com.ardor3d.scenegraph.extension.BillboardNode.BillboardAlignment;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.util.TextureManager;

/**
 * Implements the star information billboard for a star (non-colony).
 * 
 * @author Roslan Amir
 * @version 1.0 - Aug 10, 2011
 */
public class StarBillboardNode extends Node {

	/**
	 * Constructor.
	 * 
	 * @param name
	 */
	public StarBillboardNode(String name) {
		super(name);

		/*
		 * The player banner billboard
		 */
		final BillboardNode banner = new BillboardNode("BBN-Banner");
		banner.setAlignment(BillboardAlignment.ScreenAligned);
		this.attachChildAt(banner, 0);
		Quad quad = new Quad("Quad-Banner", 8.5, 9.8);
		banner.attachChild(quad);

		TextureState ts = new TextureState();
		ts.setEnabled(true);
		ts.setTexture(TextureManager.load("images/banner-01-red.png", Texture.MinificationFilter.Trilinear, TextureStoreFormat.GuessCompressedFormat, true));
		quad.setRenderState(ts);

		/*
		 * The star name billboard
		 */
		final BillboardNode starName = new BillboardNode("BBN-StarName");
		starName.setAlignment(BillboardAlignment.ScreenAligned);
		starName.setTranslation(8.5, 4.9, 0);
		this.attachChildAt(starName, 1);
		quad = new Quad("Quad-StarName", 17.0, 4.9);
		starName.attachChild(quad);

		ts = new TextureState();
		ts.setEnabled(true);
		ts.setTexture(TextureManager.load("images/billboard-name-orion.png", Texture.MinificationFilter.Trilinear, TextureStoreFormat.GuessCompressedFormat, true));
		quad.setRenderState(ts);

		/*
		 * The environment billboard
		 */
		final BillboardNode environment = new BillboardNode("BBN-Environment");
		environment.setAlignment(BillboardAlignment.ScreenAligned);
		environment.setTranslation(8.5, 0, 0);
		this.attachChildAt(environment, 2);
		quad = new Quad("Quad-Environment", 17.0, 4.9);
		environment.attachChild(quad);

		ts = new TextureState();
		ts.setEnabled(true);
		ts.setTexture(TextureManager.load("images/billboard-special-terran.png", Texture.MinificationFilter.Trilinear, TextureStoreFormat.GuessCompressedFormat, true));
		quad.setRenderState(ts);

		/*
		 * The max pop billboard
		 */
		final BillboardNode maxPop = new BillboardNode("BBN-MaxPop");
		maxPop.setAlignment(BillboardAlignment.ScreenAligned);
		maxPop.setTranslation(25.5, 4.9, 0);
		this.attachChildAt(maxPop, 3);
		quad = new Quad("Quad-MaxPop", 4.9, 4.9);
		maxPop.attachChild(quad);

		/*
		 * The range billboard
		 */
		final BillboardNode range = new BillboardNode("BBN-Range");
		range.setAlignment(BillboardAlignment.ScreenAligned);
		range.setTranslation(25.5, 0, 0);
		this.attachChildAt(range, 4);
		quad = new Quad("Quad-Range", 4.9, 4.9);
		range.attachChild(quad);
	}

}
